//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.web.controller.member;

import com.aidong.dao.base.ConditionMap;
import com.aidong.dao.base.OrderSet;
import com.aidong.dao.base.Pagination;
import com.aidong.dao.wills.MemberShopBespeakDao;
import com.aidong.web.controller.BaseController;
import java.text.SimpleDateFormat;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping({"shopBespeak"})
public class MemberShopBespeakController extends BaseController {
    @Resource
    MemberShopBespeakDao memberShopBespeakDao;

    public MemberShopBespeakController() {
    }

    @RequestMapping({"list"})
    public ModelAndView list() {
        new SimpleDateFormat("yyyy-MM-dd");
        return new ModelAndView("member/shopbespeak/list");
    }

    @RequestMapping({"_list"})
    public ModelAndView _list(@RequestParam(value = "shopCode",required = false) String shopCode, @RequestParam(value = "mobile",required = false) String mobile, @RequestParam(value = "dateFrom",required = false) String dateFrom, @RequestParam(value = "dateTo",required = false) String dateTo, @RequestParam(value = "pageNo",required = false) String pageNo, @RequestParam(value = "totalCount",required = false) String totalCount) {
        Pagination pg = new Pagination(1, 20);
        pg.setPage(this.parseInt(pageNo), this.parseInt(totalCount));
        ConditionMap cd = new ConditionMap();
        this.addConditionShopCode(cd, "shopCode", shopCode);
        cd.eq("mobile", mobile);
        if(!this.chkNull(dateFrom)) {
            cd.ge("bespeakDate", this.getDateFrom(dateFrom));
        }

        if(!this.chkNull(dateTo)) {
            cd.le("bespeakDate", this.getDateTo(dateTo));
        }

        this.memberShopBespeakDao.queryPageList(pg, cd, (new OrderSet()).desc("autoId"));
        ModelAndView mv = new ModelAndView("member/shopbespeak/_list");
        mv.addObject("list", pg.getResultList());
        mv.addObject("pg", pg);
        return mv;
    }
}
